
module Cms
  class RecycleButton < ToolbarButton

    def action
      respond "
        var el = jQuery('.yui-dd-dragging')[0];
        el.pranentNode.removeChild(el);
        delete el;
      "
    end
    
    def render
      e :script, "
        dcat_instance.oninit(function(Y) {
          var drop = new this.Y.DD.Drop({
              node: '##{id}'
            });
          drop.on('drop:hit', function(e) {
            alert('aaa');
            jQuery.getScript('#{callback :action}');
            e.stopPropagation();
          });
        });
      "
      super()
    end
    
  end
end